<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>

        // 累乘
        var n = prompt('请输入一个数');

        var jc = 1;
        for (var i = 1; i <= n; i++) {
            jc = jc*i;
            // 简写
            // jc*=i;
        }

        console.log(jc);
    </script>
</body>

</html>